import { createApp } from 'vue'
import { naive } from '@/plugins'
import router from '@/router'
import store, { key } from '@/store'
import * as Sentry from '@sentry/vue'
import { Integrations } from '@sentry/tracing'

import App from '@/App.vue'
import AppProvider from '@/comp/app/Provider.vue'

async function bootstrap() {
    const appProvider = createApp(AppProvider)
    appProvider.mount('#appProvider', true)

    const app = createApp(App)
    app.use(store, key)
    app.use(naive)
    app.use(router)
    await router.isReady()

    // 自行搭建  Sentry
    // Sentry.init({
    //     app,
    //     dsn: 'https://55536ssssxc8660@sentry.xxxxx.com/3',
    //     environment: import.meta.env.VITE_MODE_TYPE,
    //     integrations: [
    //         new Integrations.BrowserTracing({
    //             routingInstrumentation: Sentry.vueRouterInstrumentation(router),
    //             tracingOrigins: ['localhost', /^\//],
    //         }),
    //     ],
    //     tracesSampleRate: 1.0,
    // })

    app.mount('#app')

    localStorage.removeItem('Cache.District.Tree')
}

void bootstrap()
